﻿using QFramework;
using System;

namespace HKTools
{
    public class CMD_UDP_BroadcastAckMsg : AbstractCommand
    {
        string msg;
        int broadcastPort;
        Action ensureCallback;

        public CMD_UDP_BroadcastAckMsg(string msg, int broadcastPort, Action ensureCallback = null)
        {
            this.msg = msg;
            this.broadcastPort = broadcastPort;
            this.ensureCallback = ensureCallback;
        }

        protected override void OnExecute()
        {
            if (string.IsNullOrEmpty(msg))
            {
                HKDebug.LogError("Msg 不能为空");
                return;
            }

            this.GetSystem<IHK_UdpSystem>().BroadcastAckMsg(msg, broadcastPort, ensureCallback);
        }
    }
}